#if !defined(ximera_gui_cegui_guisystem_hpp)
#define ximera_gui_cegui_guisystem_hpp

// -----------------------------------------------------------

#include <ximera/gui/iguisystem.hpp>
#include <ximera/common/sharedptr.hpp>
#include <ximera/system/application.hpp>
#include <ximera/gui/cegui/inputhandler.hpp>

#include <CEGUISystem.h>
#include <OgreCEGUIRenderer.h>

namespace ximera { namespace gui { namespace cegui
{
    class XIMERA_PLUGIN_API GuiSystem : public IGuiSystem
    {
    public:
        GuiSystem(system::Application& app);
        virtual ~GuiSystem();

        virtual void render();

        virtual void defaultFont(String const& name);
        virtual void mouseCursor(String const& imageName);

        virtual IWindow* createWindow(String const& type, String const& name);
        virtual IWindow* createWindow(String const& fileName);

        virtual void activeWindow(IWindow* window);
        virtual void loadScheme(String const& fileName);

    private:
        system::Application& _application;
        InputHandler _inputHandler;
        
        // Note: This order is necessary, need to destroy _ceguiSystem first
        SharedPtr<CEGUI::OgreCEGUIRenderer> _ogreRenderer;
        SharedPtr<CEGUI::System> _ceguiSystem;

        virtual IWindow* createWindow(CEGUI::Window* window);
    };
}}}

// -----------------------------------------------------------

#endif
